define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) {
    return {
        index: function () {
            Table.api.init({
                extend: {
                    index_url: 'vv/supply/index' + location.search,
                    add_url  : 'vv/supply/add',
                    edit_url : 'vv/supply/edit',
                    del_url  : 'vv/supply/del',
                    multi_url: 'vv/supply/multi',
                    table    : 'wanlshop_shop',
                }
            })
            const table = $("#table")
            table.bootstrapTable({
                url     : $.fn.bootstrapTable.defaults.extend.index_url,
                pk      : 'id',
                sortName: 'id',
                columns : [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        {field: 'shoptype', title: '店铺类型',searchList: {1: '非供应商', 2: '供应商'}, formatter: Table.api.formatter.normal},
                        {field: 'shopname', title: '店铺名称'},
                        {field: 'apply', title: '申请状态', searchList: {1: '申请中',0: '未申请'}, formatter: Table.api.formatter.normal},
                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            })
            Table.api.bindevent(table)
        },
        add  : function () {
            Form.api.bindevent($("form[role=form]"))
        },
        edit : function () {
            Form.api.bindevent($("form[role=form]"))
        }
    }
})